package com.itheima.mall.web.oms;


import com.itheima.mall.commons.result.Result;
import com.itheima.mall.dubbo.api.oms.OrderSettingService;
import com.itheima.mall.entity.domain.oms.OrderSetting;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 订单设置表 前端控制器
 * </p>
 *
 * @author qinglang
 * @since 2022-07-05
 */
@RestController
@RequestMapping("/orderSetting")
@CrossOrigin(origins = "*")
public class OrderSettingController {
    @DubboReference
    private OrderSettingService settingService;
    /**
     * 修改指定订单设置
     * @param id
     * @return
     */
    @PostMapping("/update/{id}")
    public Result update(@PathVariable Integer id, @RequestBody OrderSetting setting){
        settingService.updateSetting(id,setting);
        return Result.success();
    }
    /**
     * 获取指定订单设置
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public Result getOne(@PathVariable Integer id){
        OrderSetting setting = settingService.getById(id);
        return Result.success(setting);
    }

}

